﻿using System;
using System.Collections.Generic;
using System.Text;
using Gammar.Price.ObjectModel;
using System.Globalization;
using Longbow.Data;

namespace Gammar.Price.DataAccess
{
    public partial class SearchContent
    {
        /// <summary>
        /// 通过主键ID获得一个SearchContentEntity实例
        /// </summary>
        /// <param name="criteria">oc_id</param>
        /// <param name="dbAccess"></param>
        /// <returns></returns>
        public SearchContentEntity RetrieveItemByKey(Guid guid, DBAccess dbAccess)
        {
            if (guid == null)
                throw new ArgumentNullException("guid");

            this._criteria = string.Format(CultureInfo.InvariantCulture, "where [oc_id] = '{0}'", guid);
            SearchContentEntity[] ret = this.Execute(dbAccess);
            return ret.Length > 0 ? ret[0] : null;
        }
    }
}
